package com.DHH.Service.Device.Impl;
import com.DHH.Entity.Device.DeviceArea;
import com.DHH.Mapper.Device.DeviceAreaMapper;
import com.DHH.Service.Device.IDeviceAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DeviceAreaServiceImpl implements IDeviceAreaService{
	
	@Autowired
    private DeviceAreaMapper deviceAreaMapper;
    
   @Override
   public DeviceArea insertDeviceArea(DeviceArea deviceArea){
	   
        deviceAreaMapper.insertSelective(deviceArea);
	   return deviceArea;
	   
   };
   @Override
   public DeviceArea updateDeviceArea(DeviceArea deviceArea){
	     deviceAreaMapper.updateByPrimaryKeySelective(deviceArea);
        return deviceArea;
   };
   @Override
   public DeviceArea deleteDeviceArea(DeviceArea deviceArea){

	     deviceAreaMapper.delete(deviceArea);
        return deviceArea;
   };
    /**
     * 保存或更新操作，返回值为主表
     */
    public DeviceArea saveOrUpdateDeviceArea(DeviceArea deviceArea){
        if(deviceArea.getId()==null)
        {
            deviceAreaMapper.insertSelective(deviceArea);
        }else{
            deviceAreaMapper.updateByPrimaryKeySelective(deviceArea);
        }
        return deviceArea;
    };
}
